import { Column } from "typeorm";

import { VARCHAR50_PG, SMALLINT_PG, INTEGER_PG, VARCHAR255_PG, ExtSkuTpl } from "qqlx-core";

import { TransformerInteger } from "@lib/orm.transfor.number";
import { TransformerVarchar50, TransformerVarchar255 } from "@lib/orm.transfor.string";

import { IdIntroSchema } from "@/alpha/ext.id.intro";

export class SkuTplSchema extends IdIntroSchema implements ExtSkuTpl {
  @Column({ transformer: new TransformerVarchar255() })
  norm: VARCHAR255_PG = "";

  @Column({ transformer: new TransformerInteger() })
  count: INTEGER_PG = 0;

  @Column({ transformer: new TransformerInteger(100) })
  price: INTEGER_PG = 0;

  @Column({ transformer: new TransformerVarchar50() })
  unit: VARCHAR50_PG = "";

  @Column({ transformer: new TransformerInteger(100) })
  tax: SMALLINT_PG = 0;
}
